package com.lining.orangeservice.common.enums;

import lombok.Getter;

/**
 * 错误码枚举
 */
@Getter
public enum ErrorCode {
    
    // 通用错误码
    SUCCESS(200, "成功"),
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "资源不存在"),
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    
    // 认证相关错误码 1000-1999
    USER_NOT_EXISTS(1001, "用户不存在"),
    USER_DISABLED(1002, "用户已被禁用"),
    PASSWORD_ERROR(1003, "密码错误"),
    LOGIN_FAILED(1004, "登录失败"),
    TOKEN_INVALID(1005, "Token无效"),
    TOKEN_EXPIRED(1006, "Token已过期"),
    
    // 用户相关错误码 2000-2999
    USERNAME_EXISTS(2001, "用户名已存在"),
    EMAIL_EXISTS(2002, "邮箱已被注册"),
    PHONE_EXISTS(2003, "手机号已被注册"),
    USER_REGISTER_FAILED(2004, "用户注册失败"),
    
    // 权限相关错误码 3000-3999
    PERMISSION_DENIED(3001, "权限不足"),
    ROLE_NOT_EXISTS(3002, "角色不存在"),
    PERMISSION_NOT_EXISTS(3003,"权限不存在" ),
    PERMISSION_NAME_EXISTS(3004, "权限名称已存在"),
    // 业务相关错误码 4000-4999
    BUSINESS_ERROR(4001, "业务异常") ;

    private final int code;
    private final String message;

    ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
}